package com.my.okhttps.test;

import com.my.core.api.R;
import com.my.okhttps.test.service.ISheBaoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 访问公共服务平台查询社保
 * @author timo 2020/12/24
 */
@RestController
@RequestMapping("/shebao/shebaoquery")
@Slf4j
public class SheBaoController {

    @Autowired
    private ISheBaoService sheBaoService;

    @GetMapping(value = "/getSheBaoBaseInfo")
    public R<?> getSheBaoBaseInfo(@RequestParam String idCard, @RequestParam(required = false) String name){
        return R.data(sheBaoService.getshebaoCbxx(idCard,name));
    }

    /**
     * 养老缴费
     * @param chargeType 参保信息返回的缴费类型
     * @param gerenNo 个人编码
     * @param userStatus
     * @param startrow 开始列
     * @param endrow 结束
     * @return
     */
    @GetMapping("yangLaoJiaoFei")
    public R<?> yangLaoJiaoFei(@RequestParam String chargeType,
                                                @RequestParam String gerenNo,
                                                @RequestParam(required = false,defaultValue = "在职")String userStatus,
                                                @RequestParam(required = false,defaultValue = "0")String startrow,
                                                @RequestParam(required = false,defaultValue = "10086")String endrow) {
        return R.data(sheBaoService.getshebaoYangLaoJiaoFei(chargeType,gerenNo,userStatus,startrow,endrow));
    }

    /**
     * 工伤失业缴费
     * @param gerenNo
     * @param startrow 开始列
     * @param endrow 结束
     * @param type  1 失业 0工伤
     * @return
     */
    @GetMapping("gongShangShiyeJiaoFei")
    public R<?>  gongShangShiyeJiaoFei(@RequestParam String gerenNo,
                                                        @RequestParam(required = false,defaultValue = "0")String startrow,
                                                        @RequestParam(required = false,defaultValue = "10086")String endrow,
                                                        @RequestParam(required = false,defaultValue = "0")Integer type) {
        return R.data(sheBaoService.getshebaoGongShangShiyeJiaoFei(gerenNo,startrow,endrow,type));
    }

}
